package com.mathlearning.auth.dto.problem;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProblemDetailResponse {
    private Long id;
    private String title;
    private String difficulty;
    private String type;
    private String description;
    private String inputDescription;
    private String outputDescription;
    private List<Example> examples;
    private List<String> hints;
    private List<String> tags;
    private List<Option> options;  // 选择题选项
    private BigDecimal acceptanceRate;
    private Integer submitCount;
    private Integer acceptedCount;
    private String solution;  // 仅在用户通过后或查看题解后返回

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Example {
        private String input;
        private String output;
        private String explanation;
    }

    @Data
    @NoArgsConstructor
    public static class Option {
        private String key;
        private String text;
        
        // 全参构造函数
        public Option(String key, String text) {
            this.key = key;
            this.text = text;
        }
        
        // 字符串构造函数以支持Jackson反序列化
        @JsonCreator
        public Option(String text) {
            this.key = text;
            this.text = text;
        }
    }
}








